#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QUrl>

#include <messaginglayer/cauthinfo.h>
#include <messaginglayer/contactinfo.h>
#include <messaginglayer/cmessage.h>
#include <messaginglayer/cprofile.h>

class CProfile;

class ICore;
class GeneralSettings;
class MessagingWidget;
class RightPane;
class StartupWidget;
class ContactsWidget;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

signals:
    void profileChanged(CProfile *);

public slots:
    void changeProfile(const CAuthInfo&);
    void openMessaging(const ContactInfo &cinfo);
    void openSettingsDialog(const QString &initialCategory = QString(),
                            const QString &initialPage = QString());

private slots:
    void contextChanged();
    void styleChangeRequest();
    void openHelp(const QUrl &url = QUrl());
    void aboutDialog();

    void profileStateChanged(CProfile::State state);
    void profileError(CProfile::Error);
    void profileMessageReceived(const CMessage &message);

private:
    void loadTranslations();
    void createWindowLayout();
    void createActions();

    void registerContexts();

    QMenu * populateStylesMenu();

    ICore * m_core;
    GeneralSettings * m_generalSettings;

    StartupWidget * m_startupWidget;
    ContactsWidget * m_contactsWidget;
    MessagingWidget * m_messagingWidget;
    RightPane * m_rightPane;
};

#endif // MAINWINDOW_H
